import java.util.Scanner;


public class DIVSUM2 {
	public static void main (String args[]) {
		Scanner in = new Scanner(System.in);
		int testcases = in.nextInt();
		int sum, k, i;
		while (testcases-- > 0) {
			int number = in.nextInt();
			sum = 1;
			k = (number/2) + 1;
			i = 2;
			while (i < k) {
				if ((number % i) == 0) {
					sum += (i + (number/i));
					k = k/i;
				}
				i++;
			}
			System.out.println(sum);
		}
	}
}
